local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.BaseComponent());
local baseSpeed= CommonOHOH.config.Game.WalkSpeed


function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);

    self.player=self.parent.player

    self.player.SpeedPointChangeEvent:Connect(function()
            self:Update()
    end)

    self.player.SpeedValueAddEvent:Connect(function()
            return baseSpeed
    end)
    self:Update()

end;

function M.GetSpeed(self)

   local list= self.player.SpeedValueAddEvent:Action()
   local sum=0
   for _,v in pairs(list) do
     sum=sum+v
   end
   return sum
   
end

function M.Update(self)
    self.parent:GetHumanoid().WalkSpeed=self:GetSpeed()
end

function M.dtor(self)
	M.super.dtor(self);
end

return M

